﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once

#include "GcmpModelInterface.h"
#include "IGeometryRelationship.h"
#include "RegenDataId.h"
#include "JoinPositions.h"
#include "GcmpApiDeclaration.h"

namespace gcmp
{
    class IDocument;
    class IElement;
    class ElementId;
    

    /// \brief 连接关系行为，管理对象间的连接关系
    class GCMP_MODEL_INTERFACE_EXPORT IJoinRelationshipBehavior : public IGeometryRelationship
    {
        DEFINE_CAST_DERIVED(gcmp::IJoinRelationshipBehavior, gcmp::IGeometryRelationship);

    public:
        /// \brief 创建连接关系行为
        /// \param pDocument 当前文档
        /// \param ownerElementId 宿主对象的
        /// \return 连接关系行为
        static OwnerPtr<IJoinRelationshipBehavior> Create(IElement* pElement);

        /// \brief 获取起点连接对象的ElementIds
        /// 
        /// \return 起点连接对象的ElementIds
        virtual const std::vector<ElementId>& GetElementJoinIdsAtStart() const = 0;

        /// \brief 添加起点连接对象的ElementId
        /// 
        /// \param elementId 起点连接对象的ElementId
        /// \return True：添加成功，false：添加失败
        virtual bool AddElementJoinIdAtStart(const ElementId& elementId) = 0;

        /// \brief 移除起点连接对象的ElementIds
        /// 
        /// \param elementIds 起点连接对象的ElementIds
        /// \return True：移除成功，false：移除失败
        virtual bool DeleteElementJoinIdsAtStart(const std::vector<ElementId>& elementIds) = 0;

        /// \brief 获取终点连接对象的ElementIds
        /// 
        /// \return 终点连接对象的ElementId
        virtual const std::vector<ElementId>& GetElementJoinIdsAtEnd() const = 0;

        /// \brief 添加终点连接对象的ElementId
        /// \param elementId 终点连接对象的ElementId
        /// \return True：添加成功，false：添加失败
        virtual bool AddElementJoinIdAtEnd(const ElementId& elementId) = 0;

        /// \brief 移除终点连接对象的ElementIds
        /// \param elementIds 终点连接对象的ElementIds
        /// \return True：移除成功，false：移除失败
        virtual bool DeleteElementJoinIdsAtEnd(const std::vector<ElementId>& elementIds) = 0;

        /// \brief 获取中间点连接对象的ElementIds
        /// \return 中间点连接对象的ElementIds
        virtual const std::vector<ElementId>& GetElementJoinIdsAtMiddle() const = 0;

        /// \brief 添加中间点连接对象的ElementId
        /// \param elementId 中间点连接对象的ElementId
        /// \return True：添加成功，false：添加失败
        virtual bool AddElementJoinIdAtMiddle(const ElementId& elementId) = 0;

        /// \brief 移除中间点连接对象的ElementIds
        /// \param elementIds 中间点连接对象的ElementIds
        /// \return True：移除成功，false：移除失败
        virtual bool DeleteElementJoinIdsAtMiddle(const std::vector<ElementId>& elementIds) = 0; 

        /// \brief 根据连接位置获取对象的ElementIds
        /// \param joinPosition 构件连接位置
        /// \return  连接对象的ElementIds
        virtual const std::vector<ElementId> GetElementJoinIds(JoinPosition joinPosition) const = 0;

        /// \brief 根据连接位置添加连接对象的ElementId
        /// \param elementId 连接对象的ElementId
        /// \param joinPosition 构件连接位置
        /// \return 返回true表示成功，否则表示失败
        virtual bool AddElementJoinId(const ElementId& elementId, JoinPosition joinPosition) = 0;

        /// \brief 移除连接位置的连接对象的ElementIds
        /// \param elementIds 连接对象的ElementIds
        /// \param joinPosition 构件连接位置
        /// \return True：移除成功，false：移除失败
        virtual bool DeleteElementJoinIds(const std::vector<ElementId>& elementIds, JoinPosition joinPosition) = 0;

        /// \brief 根据连接位置，获取连接对象ElementId的RegenDataId
        /// \return 连接对象ElementId的RegenDataId
        virtual RegenDataId GetElementJoinIdRdId() const = 0;

        /// \brief 根据连接位置，标记连接对象ElementId的RegenDataId
        /// \return void
        virtual void MarkElementJoinIdRdId() = 0;

    };
}


